package com.zzti.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.zzti.util.DButil;

// 封装针对user的数据操作
public class UserDao {
	// 从数据库查询数据
	public boolean queryUser(String name, String psw) {
		String sql = "select * from user where username = ? and password = ?";
		ResultSet rs = DButil.select(sql, new Object[] { name, psw });
		// 判断是否存在该数据
		try {
			if (rs.next()) {
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				DButil.closeAll();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return false;
	}
}
